﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Discussion-Board/discussion.master" AutoEventWireup="true"
    CodeFile="submit-post.aspx.cs" Inherits="forum_submit_post" ValidateRequest="false" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript" src="../Scripts/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="../Scripts/ckeditor/adapters/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#ckeditor').ckeditor();
            $('#ckeditor').val($("#<%= hidCKEDitorValue.ClientID %>").val());
        });
        function GetCKEditorData() {
            var data = $('#ckeditor').val();
            if (data != "") {
                $("#<%= hidCKEDitorValue.ClientID %>").val(data);
                return true;
            }
            else {
                alert("Empty is not allowed.");
                return false;
            }

        }
        function ResetFields() {
            $('#ckeditor').val() = '';
        }
    </script>
    <script src="../Scripts/jquery.autoclear.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function () { $('.autoclear').autoclear(); });</script>
    <section id="divMessage" runat="server" visible="false">
        <asp:Literal ID="lblMessage" runat="server"></asp:Literal>
       
    </section>
     <section class="title-regular">New Discussion</section>
        <hr />
    <p>
        <asp:DropDownList ID="ddlCategory" runat="server" AppendDataBoundItems="true" DataTextField="CategoryName"
            DataValueField="CategoryId" CssClass="grid_5 margin-left-zero">
            <asp:ListItem Text="Select Category" Value="-1"></asp:ListItem>
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="rfvddlCategory" InitialValue="-1" runat="server" ErrorMessage="*" ControlToValidate="ddlCategory"
            SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>
        <br />
        <input type="text" id="txtSubject" name="txtSubject" runat="server" required placeholder="Subject" class="text autoclear grid-5-manual" />
        <br />
        <asp:RequiredFieldValidator ID="rfvtxtSubject" runat="server" ErrorMessage="*" ControlToValidate="txtSubject"
            SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>
    </p>
    
    <textarea name="editor1" id="ckeditor" class="autoclear">Type in your message</textarea>
    <input id="hidCKEDitorValue" type="hidden" runat="server" />
    <br />
    <asp:LinkButton ID="lnbAddNew" runat="server" CssClass="button medium blue" OnClick="lnbAddNew_Click"
        OnClientClick="javascript:return GetCKEditorData();">Submit</asp:LinkButton>
    <asp:LinkButton ID="LinkButton1" runat="server" CssClass="button medium gray" PostBackUrl="~/discussion-board/default.aspx">Cancel</asp:LinkButton>
</asp:Content>
